﻿var bstartnextplay=false;
function $Showhtml(){
	var player;url=$Qvodurl(url,pid);
	player='<object id="QvodPlayer" name="QvodPlayer" width="100%" height="'+height+'" classid="clsid:F3D0D36F-23F8-4682-A195-74C92B03D4AF" onError="$Install(\'qvod\');">';
	player+='<PARAM NAME="URL" VALUE="'+url+'">';
	player+='<PARAM NAME="Autoplay" VALUE="'+autoPlay+'">';
	player+='<PARAM NAME="QvodAdUrl" VALUE="'+adsPage+'">';
	if(nextpath != "no"){
		player+='<PARAM NAME="NextWebPage" VALUE="'+nexturl+'">';
		nextpath=$Qvodurl(nextpath,pid+1);
	}	
	player+='</object><scr'+'ipt>setInterval("$ShowSwf()",500);setInterval("$NextPath()",9333);</scr'+'ipt>';
	return(player);
}

function $ShowSwf(){
	try{
		if(QvodPlayer.Full==0){
			if(QvodPlayer.PlayState==3){
				$$('QvodPlayer').style.height = height;
				$$('playad').style.display='none';
			}else{
				$$('playad').style.display='inline';
				$$('playadi').style.height=height-59;
				$$('QvodPlayer').style.height=59;
			}
		}
	} catch(e) {}
}

function $NextPath(){
	if(nextpath != "no"){
		if(QvodPlayer.get_CurTaskProcess()>=800 && !bstartnextplay){
			QvodPlayer.StartNextDown(nextpath);
			bstartnextplay = true;
		}
	}
}

function $Qvodurl(url,pid){
	var qvodurl;
	if(url.indexOf("vod://")>0){
		url=url.split("|");
		qvodurl=url[0]+"|"+url[1]+"|["+document.domain+"]"+url[2]+"|";
		return(qvodurl);
	}
	return(url);
}